home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXT Education Software Sampler 1992 Fall
/
NeXT Education Software Sampler 1992 Fall.iso
/
SoundAndMusic
/
cmix
/
Minc
/
lex.l
< prev
next >
Wrap
Text File
|
1991-03-16
|
1KB
|
50 lines
%START INIT COM
%{
#include "y.tab.h"
int comments=0;
%}
l [a-zA-Z]
dig [1234567890]
real ({dig}+)((".")({dig}*)(("E"|"e")(("+"|"-")?)({dig}+))?)?
real2 (".")({dig}+)(("E"|"e")(("+"|"-")?)({dig}+))?
num {dig}+
%%
<INIT>"/*" {BEGIN COM;comments++;}
<COM>"/*" {comments++;}
<COM>.|\n ;
<COM>"*/" {comments--;if (comments==0){BEGIN INIT;}}
<INIT>{real} return(NUM);
<INIT>{real2} return(NUM);
<INIT>"<>"|"!=" return (UNEQU);
<INIT>"<=" return (LESSEQU);
<INIT>">=" return (GTREQU);
<INIT>"==" return (T_EQU);
<INIT>"**"|"^" return (T_POW);
<INIT>"\""[^\"]*"\"" return (STRING);
<INIT>[fF][oO][rR] return (FOR);
<INIT>[iI][fF] return (IF);
<INIT>[eE][lL][sS][eE] return (ELSE);
<INIT>[wW][hH][iI][lL][eE] return (WHILE);
<INIT>[aA][nN][dD] return (T_AND);
<INIT>"&&" return (T_AND);
<INIT>[nN][oO][tT] return (T_NOT);
<INIT>"!"|"~" return (T_NOT);
<INIT>[oO][rR] return (T_OR);
<INIT>"||" return (T_OR);
<INIT>[tT][rR][uU][eE] return (T_TRUE);
<INIT>[fF][aA][lL][sS][eE] return (T_FALSE);
<INIT>[fF][lL][oO][aA][tT] return (FLT);
<INIT>[=><{},;*+-] return (*yytext);
<INIT>"["|"]"|"/" return (*yytext);
<INIT>"("|")" return (*yytext);
<INIT>"\n" ;
<INIT>" "|"\t" ;
<INIT>{l}({l}|{dig}|"#"|"_"|".")* return (ID);
<INIT>. yyerror("illegal character");
.|"\n" {BEGIN INIT;unput(yytext[0]);}
%%